<template>
  <div class="v-checkbox-group" ref="input">
    <slot/>
  </div>
</template>


<script>
export default {
  props: {
    value: {
      default() {
        return [];
      }
    }
  },
  computed: {
    join() {
      return "join" in this.$attrs ? this.$attrs.join || "," : "";
    },
    selected: {
      get() {
        if (this.join) {
          return this.value instanceof Array
            ? this.value
            : String(this.value)
                .split(this.join)
                .filter(o => o);
        } else {
          return this.value instanceof Array ? this.value : [this.value];
        }
      },
      set(value) {
        this.$emit("input", this.join ? value.join(this.join) : value);
      }
    }
  }
};
</script>
